using System;
using System.Activities;
using Headsight.BPMN2WF.BPMN.Model;
using Headsight.BPMN2WF.Transformation;

namespace Headsight.BPMN2WF.Testing
{
    /// <summary>
    /// <see cref="IBPMN2WFTransformation"/> implementation for testing purposes. 
    /// </summary>
    public class BPMN2WFTransformation_4TestingAssign : IBPMN2WFTransformation
    {
        public BPMNTransformationResult Transform(IBPMN2WFTransformationContext ctx, BPMNFlowNode flowNode)
        {
            var activity = new FourTestingActivity { Text = flowNode.Id };

            return new BPMNTransformationResult(activity, activity, activity);
        }
    }

    public class FourTestingActivity : NativeActivity
    {
        public InArgument<String> Text { get; set; }

        protected override void Execute(NativeActivityContext context)
        {
            var text = Text.Get(context);

            Console.WriteLine(@"****FourTestingActivity: {0}****", text);
        }

        private void onCompleted(NativeActivityContext context, ActivityInstance completedinstance, int result)
        {
            Console.WriteLine("Ready");
        }
    }
}